package cn.zymall.goods.service.impl;

import cn.zymall.common.model.Collect;
import cn.zymall.goods.mapper.CollectMapper;

import cn.zymall.goods.service.CollectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author lxh
 * @Description 收藏业务层实现类
 * @date 2020/8/27 20:52
 * @Classname CollectServiceImpl
 **/
@Service
public class CollectServiceImpl extends ServiceImpl<CollectMapper, Collect> implements CollectService {

	@Autowired
	private CollectMapper collectMapper;

	@Override
	public void addMyCollect(Collect collect) {
		collectMapper.addMyCollect(collect);
		collectMapper.addCollectSum(collect.getSpuId());
	}

	@Override
	public void deleteMyCollect(Collect collect) {
		collectMapper.deleteMyCollect(collect);
		collectMapper.delCollectSum(collect.getSpuId());
	}

	@Override
	public Integer getCollectCount(Collect collect) {
		return collectMapper.getCollectCount(collect);
	}
}
